package mouseAndKeyAndScroll;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;       // 抽象类
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

// 快捷键设置
public class ShortcutKeyDemo extends Application {
	private Pane root = new Pane();
	private KeyCombination kc;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		Scene scene = new Scene(root, 500, 400);
		
		kc = new KeyCodeCombination(KeyCode.A, KeyCombination.CONTROL_DOWN);   // control加A（还可设置多个）
		scene.getAccelerators().put(kc, new Runnable() {
			@Override
			public void run() {
				System.out.println("设置快捷键");
			}
		});
		
		stage.setScene(scene);
		stage.show();
	}
}
